package com.cy.pj.sys.pojo;

import oracle.jrockit.jfr.jdkevents.ThrowableTracer;

import java.io.Serializable;
//用于在controller中封装数据返回浏览器
public class JsonResult implements Serializable {
    private static final long serialVersionUID = -7132574947577599624L;
    //状态码
    private int state = 1;
    //状态信息
    private String message = "ok";
    //正确的数据
    private Object data;

    public JsonResult() {
    }

    public JsonResult(String message) {
        this.message = message;
    }

    //封装查询结果
    public JsonResult(Object data) {
        this.data = data;
    }

    //封装异常
    public JsonResult(Throwable t) {
        this.state = 0;
        this.message = t.getMessage();
    }

    public int getState() {
        return state;
    }
    public void setState(int state) {
        this.state = state;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public Object getData() {
        return data;
    }
    public void setData(Object data) {
        this.data = data;
    }

}
